home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / ada / gnat1792.zip / gnat179b / t-adainc / s-pthrea.ads < prev    next >
Text File  |  1994-05-19  |  11KB  |  315 lines

  1. ------------------------------------------------------------------------------
  2. --                                                                          --
  3. --                 GNU ADA RUNTIME LIBRARY (GNARL) COMPONENTS               --
  4. --                                                                          --
  5. --                        S Y S T E M . P T H R E A D S                     --
  6. --                                                                          --
  7. --                                  S p e c                                 --
  8. --                                                                          --
  9. --                             $Revision: 1.8 $                             --
  10. --                                                                          --
  11. --           Copyright (c) 1991,1992,1993, FSU, All Rights Reserved         --
  12. --                                                                          --
  13. --  GNARL is free software; you can redistribute it and/or modify it  under --
  14. --  terms  of  the  GNU  Library General Public License as published by the --
  15. --  Free Software Foundation; either version 2,  or (at  your  option)  any --
  16. --  later  version.   GNARL is distributed in the hope that it will be use- --
  17. --  ful, but but WITHOUT ANY WARRANTY; without even the implied warranty of --
  18. --  MERCHANTABILITY  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Gen- --
  19. --  eral Library Public License for more details.  You should have received --
  20. --  a  copy of the GNU Library General Public License along with GNARL; see --
  21. --  file COPYING. If not, write to the Free Software Foundation,  675  Mass --
  22. --  Ave, Cambridge, MA 02139, USA.                                          --
  23. --                                                                          --
  24. ------------------------------------------------------------------------------
  25.  
  26. --  This package interfaces with Pthrads. It is not a complete interface;
  27. --  it only includes what is needed to implement the Ada runtime.
  28.  
  29. with System.POSIX_Constants;
  30. with System.POSIX_RTE;       use System.POSIX_RTE;
  31. with System.POSIX_ERROR;     use System.POSIX_ERROR;
  32. with System.POSIX_Timers;
  33.  
  34. package System.Pthreads is
  35.  
  36.    Pthreads_Error : exception;
  37.  
  38.    subtype Priority_Type is Integer
  39.      range System.Priority'First ..
  40.            System.Priority'Last + POSIX_Constants.Add_Prio;
  41.  
  42.    subtype size_t is Integer;
  43.  
  44.    type pthread_t       is private;
  45.    type pthread_mutex_t is private;
  46.    type pthread_cond_t  is private;
  47.  
  48.    type pthread_attr_t      is private;
  49.    type pthread_mutexattr_t is private;
  50.    type pthread_condattr_t  is private;
  51.    type pthread_key_t       is private;
  52.    type pthread_protocol_t  is private;
  53.  
  54.    NO_PRIO_INHERIT : constant pthread_protocol_t;
  55.    PRIO_INHERIT    : constant pthread_protocol_t;
  56.    PRIO_PROTECT    : constant pthread_protocol_t;
  57.  
  58.    procedure pthread_attr_init
  59.      (attributes : out pthread_attr_t;
  60.       result     : out Return_Code);
  61.    pragma Inline (pthread_attr_init);
  62.  
  63.    procedure pthread_attr_setstacksize
  64.      (attr      : in out pthread_attr_t;
  65.       stacksize : size_t;
  66.       result    : out Return_Code);
  67.    pragma Inline (pthread_attr_setstacksize);
  68.  
  69.    procedure pthread_attr_setdetachstate
  70.      (attr        : in out pthread_attr_t;
  71.       detachstate : Integer;
  72.       Result      : out Return_Code);
  73.    pragma Inline (pthread_attr_setdetachstate);
  74.  
  75.    procedure pthread_create
  76.      (thread        : out pthread_t;
  77.       attributes    : pthread_attr_t;
  78.       start_routine : System.Address;
  79.       arg           : System.Address;
  80.       result        : out Return_Code);
  81.    pragma Inline (pthread_create);
  82.  
  83.    procedure pthread_init;
  84.  
  85.    function pthread_self return pthread_t;
  86.    pragma Inline (pthread_self);
  87.  
  88.    procedure pthread_detach
  89.      (thread : in out pthread_t;
  90.       result : out Return_Code);
  91.    pragma Inline (pthread_detach);
  92.  
  93.    procedure pthread_mutexattr_init
  94.      (attributes : out pthread_mutexattr_t;
  95.       result     : out Return_Code);
  96.    pragma Inline (pthread_mutexattr_init);
  97.  
  98.    procedure pthread_mutexattr_setprotocol
  99.      (attributes : in out pthread_mutexattr_t;
  100.       protocol   : pthread_protocol_t;
  101.       result     : out Return_Code);
  102.    pragma Inline (pthread_mutexattr_setprotocol);
  103.  
  104.    procedure pthread_mutexattr_setprio_ceiling
  105.      (attributes   : in out pthread_mutexattr_t;
  106.       prio_ceiling : Integer;
  107.       result       : out Return_Code);
  108.    pragma Inline (pthread_mutexattr_setprio_ceiling);
  109.  
  110.    procedure pthread_mutex_init
  111.      (mutex      : out pthread_mutex_t;
  112.       attributes : pthread_mutexattr_t;
  113.       result     : out Return_Code);
  114.    pragma Inline (pthread_mutex_init);
  115.  
  116.    procedure pthread_mutex_destroy
  117.      (mutex  : in out pthread_mutex_t;
  118.       result : out Return_Code);
  119.    pragma Inline (pthread_mutex_destroy);
  120.  
  121.    procedure pthread_mutex_trylock
  122.      (mutex  : in out pthread_mutex_t;
  123.       result : out Return_Code);
  124.    pragma Inline (pthread_mutex_trylock);
  125.  
  126.    procedure pthread_mutex_lock
  127.      (mutex  : in out pthread_mutex_t;
  128.       result : out Return_Code);
  129.    pragma Inline (pthread_mutex_lock);
  130.  
  131.    procedure pthread_mutex_unlock
  132.      (mutex  : in out pthread_mutex_t;
  133.       result : out Return_Code);
  134.    pragma Inline (pthread_mutex_unlock);
  135.  
  136.    procedure pthread_cond_init
  137.      (condition  : out pthread_cond_t;
  138.       attributes : pthread_condattr_t;
  139.       result     : out Return_Code);
  140.    pragma Inline (pthread_cond_init);
  141.  
  142.    procedure pthread_cond_wait
  143.      (condition : in out pthread_cond_t;
  144.       mutex     : in out pthread_mutex_t;
  145.       result    : out Return_Code);
  146.    pragma Inline (pthread_cond_wait);
  147.  
  148.    procedure pthread_cond_timedwait
  149.      (condition     : in out pthread_cond_t;
  150.       mutex         : in out pthread_mutex_t;
  151.       absolute_time : POSIX_Timers.timespec;
  152.       result        : out Return_Code);
  153.    pragma Inline (pthread_cond_timedwait);
  154.  
  155.    procedure pthread_cond_signal
  156.      (condition : in out pthread_cond_t;
  157.       result    : out Return_Code);
  158.    pragma Inline (pthread_cond_signal);
  159.  
  160.    procedure pthread_cond_broadcast
  161.      (condition : in out pthread_cond_t;
  162.       result    : out Return_Code);
  163.    pragma Inline (pthread_cond_broadcast);
  164.  
  165.    procedure pthread_cond_destroy
  166.      (condition : in out pthread_cond_t;
  167.       result    : out Return_Code);
  168.    pragma Inline (pthread_cond_destroy);
  169.  
  170.    procedure pthread_condattr_init
  171.      (attributes : out pthread_condattr_t;
  172.       result     : out Return_Code);
  173.    pragma Inline (pthread_condattr_init);
  174.  
  175.    procedure pthread_condattr_destroy
  176.      (attributes : in out pthread_condattr_t;
  177.       result     : out Return_Code);
  178.    pragma Inline (pthread_condattr_destroy);
  179.  
  180.    procedure pthread_setspecific
  181.      (key    : pthread_key_t;
  182.       value  : System.Address;
  183.       result : out Return_Code);
  184.    pragma Inline (pthread_setspecific);
  185.  
  186.    procedure pthread_getspecific
  187.      (key    : pthread_key_t;
  188.       value  : out System.Address;
  189.       result : out Return_Code);
  190.    pragma Inline (pthread_getspecific);
  191.  
  192.    procedure pthread_key_create
  193.      (key        : out pthread_key_t;
  194.       destructor : System.Address;
  195.       result     : out Return_Code);
  196.    pragma Inline (pthread_key_create);
  197.  
  198.    procedure pthread_setprio
  199.      (thread   : pthread_t;
  200.       priority : Priority_Type;
  201.       result   : out Return_Code);
  202.    pragma Inline (pthread_setprio);
  203.  
  204.    procedure pthread_attr_setprio
  205.      (attr     : in out pthread_attr_t;
  206.       priority : Priority_Type;
  207.       result   : out Return_Code);
  208.    pragma Inline (pthread_attr_setprio);
  209.  
  210.    procedure pthread_attr_getprio
  211.      (attr     : pthread_attr_t;
  212.       priority : out Priority_Type;
  213.       result   : out Return_Code);
  214.    pragma Inline (pthread_attr_getprio);
  215.  
  216.    procedure pthread_setschedattr
  217.      (thread     : pthread_t;
  218.       attributes : pthread_attr_t;
  219.       result     : out Return_Code);
  220.    pragma Inline (pthread_setschedattr);
  221.  
  222.    procedure pthread_getschedattr
  223.      (thread     : pthread_t;
  224.       attributes : out pthread_attr_t;
  225.       result     : out Return_Code);
  226.    pragma Inline (pthread_getschedattr);
  227.  
  228.    procedure pthread_exit (status : System.Address);
  229.    pragma Interface (C, pthrea